import { post } from '@/utils/http';

const Upload = {
    /**
     * 获取上传信息
     * @param {object} params
     * @param {string} params.name 
     * @param {string} params.size 
     * @param {string} params.md5 
     * @param {string} params.category 
     * @param {string} params.contentType 
     * @param {string} params.private 
     * @returns
     */
	getUploadInfo( params ) {
		return post(`/sdk/cloud/oss/upload/info`, params, { 
      apiLevel: 'apiToken', 
      header: { 'Content-Type': 'application/json' } 
    });
	},
    /**
     * 完成文件(分片)上传  --文件上传后需要调用
     * @param {object} params
     * @param {string} params.bucket 
     * @param {string} params.dfsID 
     * @param {string} params.uploadID 
     * @param {object} params.fileInfo 
     * @returns
     */
	uploadComplete( params ) {
		return post(`/sdk/cloud/oss/upload/complete`, params, { 
      apiLevel: 'apiToken',  
      header: { 'Content-Type': 'application/json'} 
    });
	}
};

export default Upload;
